import { administrator } from '../../src/lib/Member'
import { errorMsg, okMsg } from '../../src/utils/socket-message'
import {ClsMember} from "../model";

export default function(client, io) {
  // 获取 - 管理员列表
  client.on('administrator:get', async function(data, cb) {
    const { classId = 'administrator' } = data;
    console.log('获取 - 管理员列表: => ', classId);

    const members = await ClsMember.find({ where: { classId }})

    if (cb) {
      cb(okMsg('administrator:get', { data: members }))
    }
  });
}
